package com.project.lk.nurseapp.doctor.presenter;

import com.project.lk.nurseapp.base.BaseApi;
import com.project.lk.nurseapp.base.BasePresenter;
import com.project.lk.nurseapp.base.ModelPresenterBridge;
import com.project.lk.nurseapp.doctor.model.DoctorDetailsModel;

import java.util.List;

/**
 * 功能介绍：
 * 项目名：
 * 模块名称：
 * 作者：LK
 * 日期：2018/1/9
 * 修改日期：
 */

public class DoctorDetailsPresenter extends BasePresenter<IDoctorDetailsView> implements ModelPresenterBridge{

    DoctorDetailsModel doctorDetailsModel;
    public DoctorDetailsPresenter(IDoctorDetailsView view){
        doctorDetailsModel=new DoctorDetailsModel();
        doctorDetailsModel.setBridge(this);
        addView(view);
    }

    public void loadDetails(String url,String sessionId){
        doctorDetailsModel.postLoadJson(url,sessionId);
    }

    @Override
    public void bridge(int action, List list) {
        if (view!=null) {
            switch (action){
                case BaseApi.success:
                    view.returnSuccess();
                    break;
                case BaseApi.fail:
                    view.fail();
                    break;
            }
        }
    }
}
